import { Controller, UseFilters, UseInterceptors, UsePipes, ValidationPipe, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { Crud, CrudController } from '@nestjsx/crud';
import { Photo } from 'libs/db/entity/photo.entity';
import { HttpExceptionFilter } from '../_filter/http-exception.filter';
import { LoggingInterceptor } from '../_interceptor/logging.interceptor';
import { PhotoCrudOps } from './photo-crud-ops';
import { PhotoService } from './photo.service';
import { AuthGuard } from '@nestjs/passport';


@Crud(PhotoCrudOps)
@UseFilters(HttpExceptionFilter)
@UsePipes(ValidationPipe)
@UseInterceptors(LoggingInterceptor)
@UseGuards(AuthGuard('jwt-admin'))
@ApiBearerAuth()
@ApiTags('照片管理-开发实例')   //标签
@Controller('Photo')
export class PhotoController implements CrudController<Photo> {
  constructor(public service: PhotoService) {
  }

  // @Get('throw')
  // showExpection() {
  //   throw new RequestTimeoutException()
  // }
}
